<style>
    #ribbon{
        display: none;
    }
</style>
<div class="content">
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">套餐ID:</label>
            <div class="col-xs-12 col-sm-8">
                <select name="copy_id" style="width:200px;height:30px;" id="copy_id">
                    {volist name="arr" id="vo"}
                        <option value="{$vo.id}">ID:{$vo.id}  标题：{$vo.ptitle}</option>
                    {/volist}
                </select>
                <input id="package_id" class="form-control" name="package_id" value="{$id}" type="hidden">
                <input id="pid" class="form-control" name="pid" value="{$pid}" type="hidden" >
            </div>
        </div>
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="button" class="btn btn-success btn-embossed" onclick="sub('{$flag}');">确定</button>
            </div>
        </div>

</div>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
    function sub(flag){
        //alert(flag);
        //return;
        var package_id=$("#package_id").val();// 当前套餐的ID
        var pid=$("#pid").val();             // 产品ID
        var copy_id=$("#copy_id option:selected").val();     //需要复制套餐id

        if(flag=='route'){
            $.ajax({
                type:'post',
                dataType:'json',
                url:'/admin/product/route_copy_add',
                data:{"copy_id":copy_id,"pid":pid,"package_id":package_id},
                success:function(data){
                    if(data.status==1){
                        alert(data.message);
                        window.parent.location.reload();
                    }else{
                        alert(data.message);
                    }
                }
            })
        }else{
            $.ajax({
                type:'post',
                dataType:'json',
                url:'/admin/product/group_copy_add',
                data:{"copy_id":copy_id,"pid":pid,"package_id":package_id},
                success:function(data){
                    if(data.status==1){
                        alert(data.message);
                        window.parent.location.reload();
                    }else{
                        alert(data.message);
                    }
                }
            })

        }



    }
</script>

